﻿package mortal.game.net.command.wizard
{
    import Framework.MQ.*;
    import Message.Public.*;
    import mortal.game.mvc.*;
    import mortal.game.net.broadCast.*;
    import mortal.mvc.core.*;

    public class WizardUpdateCommand extends BroadCastCall
    {

        public function WizardUpdateCommand(param1:Object)
        {
            super(param1);
            return;
        }// end function

        override public function call(param1:MessageBlock) : void
        {
            var _loc_2:* = param1.messageBase as SpriteUpdate;
            switch(_loc_2.type.__value)
            {
                case ESpriteUpdateType._ESpriteUpdateAdd:
                {
                    _cache.wizard.updateSoul(_loc_2.sprite);
                    NetDispatcher.dispatchCmd(ServerCommand.WizardActive, _loc_2.sprite.SpriteCode);
                    if (_loc_2.sprite.state)
                    {
                        _cache.role.roleEntityInfo.updateWizard(_loc_2.sprite.SpriteCode);
                    }
                    break;
                }
                case ESpriteUpdateType._ESpriteUpdateSpriteLevelUp:
                {
                    _cache.wizard.updateSoul(_loc_2.sprite);
                    NetDispatcher.dispatchCmd(ServerCommand.WizardLevelUp, _loc_2.sprite.SpriteCode);
                    break;
                }
                case ESpriteUpdateType._ESpriteUpdateAcupointLevelUp:
                {
                    _cache.wizard.updateSoul(_loc_2.sprite);
                    NetDispatcher.dispatchCmd(ServerCommand.WizardAcupointLevelUp, null);
                    break;
                }
                case ESpriteUpdateType._ESpriteUpdateChange:
                {
                    _cache.wizard.updateSoul(_loc_2.sprite);
                    _cache.wizard.fightWizardCode = _loc_2.sprite.SpriteCode;
                    _cache.role.roleEntityInfo.updateWizard(_loc_2.sprite.SpriteCode);
                    NetDispatcher.dispatchCmd(ServerCommand.WizardSelectSuccess, null);
                    break;
                }
                case ESpriteUpdateType._ESpriteUpdateEquip:
                {
                    _cache.wizard.updateSoul(_loc_2.sprite);
                    NetDispatcher.dispatchCmd(ServerCommand.UpdateWizardEquip, null);
                    break;
                }
                case ESpriteUpdateType._ESpriteUpdateSkillCode:
                {
                    _cache.wizard.updateSoul(_loc_2.sprite);
                    if (GameController.wizard.isViewShow)
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.WizardSkillUpdate, null);
                    }
                    else
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.WizardWinOpen, _loc_2.sprite.SpriteCode);
                    }
                    break;
                }
                default:
                {
                    break;
                }
            }
            NetDispatcher.dispatchCmd(ServerCommand.WizardEffectPlay, _loc_2.type.__value);
            return;
        }// end function

    }
}
